package com.ruoyi.app.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 停车订单
 *
 * @author dongdong
 * @date 2025-09-12
 */
@Data
public class ParkingOrderVo implements Serializable {

    private static final long serialVersionUID = 1L;

    /** 订单ID */
    private Long id;

    /** 订单号 */
    private String orderNo;

    /** 停车场名称 */
    private String parkName;

    /** 停车场名称 */
    private String carNum;

    /** 优惠金额 */
    private BigDecimal discountAmount;

    /** 支付金额 */
    private BigDecimal payAmount;

    /** 入场时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime entryTime;

    /** 出场时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime exitTime;

    /** 支付时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime payTime;

    /** 停车时长 */
    private String duration;

    /** 发票状态：0-未开票 1-已申请 2-已开票 */
    private Integer invoiceStatus;

    @JsonFormat(shape = JsonFormat.Shape.STRING)
    public BigDecimal getDiscountAmount() {
        return discountAmount == null ? null : discountAmount.setScale(2, BigDecimal.ROUND_HALF_UP);
    }

    @JsonFormat(shape = JsonFormat.Shape.STRING)
    public BigDecimal getPayAmount() {
        return payAmount == null ? null : payAmount.setScale(2, BigDecimal.ROUND_HALF_UP);
    }
}
